<template>
  <div class="home-container">
    <div class="home">
      <div class="container">
        <div class="table">
          <el-table
            :data="tableData"
            border
            style="width: 100%"
            height="750">
            <el-table-column
              prop="id"
              label="编号"
              type="index"
              width="150"
              align="center">
            </el-table-column>
            <el-table-column
              prop="name"
              label="名称"
              align="center">
            </el-table-column>
            <el-table-column
              prop="about"
              label="描述"
              align="center">
            </el-table-column>
            <el-table-column
              prop="giteeUrl"
              label="源码地址"
              align="center">
            </el-table-column>
            <el-table-column
              label="编辑图片"
              align="center">
              <template slot-scope="scope">
                <el-button @click="editImg(scope.row.id,scope.row.name)" type="danger" size="small">编辑图片</el-button>
              </template>
            </el-table-column>
            <el-table-column
              label="编辑标签"
              align="center">
              <template slot-scope="scope">
                <el-button @click="editTag(scope.row.idscope.row.name)" type="danger" size="small">编辑标签</el-button>
              </template>
            </el-table-column>
            <el-table-column
              label="操作">
              <template slot-scope="scope">
                <el-button @click="dialogVisible=true;updatePsd(scope.row.id,scope.row.adminname)" type="warning" size="small">修改密码</el-button>
                <el-button @click="delAdmin(scope.row.id)" type="danger" size="small">删 除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {getProductList} from '../../api/myProduct/index'
export default {
  data() {
    return {
      tableData: []
    }
  },
  methods: {
    init() {
      getProductList().then( (res) => {
        console.log(res.data);
        this.tableData = res.data.data
      })
    },
    editImg(id,name) {
      this.$store.state.id = id
      this.$store.state.name = name
      this.$router.push('/admin/productImage')
    },
    editTag(id,name) {
      this.$store.state.id = id
      this.$store.state.name = name
      this.$router.push('/admin/productTag')
    }
  },
  created() {
    this.init()
  }
}
</script>

<style scoped>

</style>